// import Cookies from 'js-cookie'

const TokenKey = 'h5-vue-cli_token'
const UserInfo = 'user-info'
const Status = 'status'

export function getToken () {
  return localStorage.getItem(TokenKey)
}

export function setToken (token) {
  return localStorage.setItem(TokenKey, token)
}

export function removeToken () {
  return localStorage.removeItem(TokenKey)
}

export function setStatus(status) {
  return localStorage.setItem(Status, status)
}

export function getStatus() {
  return localStorage.getItem(Status)
}

//userinfo
export function getUserInfo () {
  let str = localStorage.getItem(UserInfo);
  let obj = {};
  if(str){
    obj = JSON.parse(str);
  }
  return obj;
}

export function setUserInfo (userInfo) {
  userInfo = userInfo || {} ;
  return localStorage.setItem(UserInfo, JSON.stringify(userInfo))
}

export function removeUserInfo () {
  return localStorage.removeItem(UserInfo)
}


